<?php
$this->pageTitle=Yii::app()->name . ' - Рассрочки';
$this->breadcrumbs=array(
	'Рассрочки',
);
?>

<fieldset>
    <legend>Рассрочки</legend>
    <div class="row">
        <div class="span12">
			<?php if(Yii::app()->user->getState('role')==Users::ADMIN_ROLE){
				$this->renderPartial('//menus/_admin_menu',array('active'=>'credits'));
			} else {
				$this->renderPartial('//menus/_manager_menu',array('active'=>'credits'));
			}?>

			<?php $this->widget('bootstrap.widgets.TbGridView', array(
				'type'=>'striped condensed',
				'dataProvider'=>$model->search(),
				'filter'=>$model,
				'enablePagination'=>true,
				'template'=>"{items}{pager}",
				'emptyText' => 'Записей о рассрочках не найдено.',
				'columns'=>array(
					array(
						'name'=>'id',
						'header'=>'#',
						'filter'=>false
					),
					array(
						'name'=>'client_fio',
						'header'=>'Ф.И.О.',
						'value'=>'CHtml::link($data->client_fio,Yii::app()->createUrl("clients/view",array("id"=>$data->id)))',
						'type'=>'raw'
					),
					array(
						'name' => 'sum',
						'htmlOptions' => array('style' => 'font-size: 12px;'),
						'filter' => false
					),
					array(
						'name' => 'duration',
						'htmlOptions' => array('style' => 'font-size: 12px;'),
						'filter' => false
					),
					array(
						'name' => 'created_at',
						'value' => 'date("d.m.Y H:i:s", strtotime($data->created_at))',
						'htmlOptions' => array('style' => 'font-size: 12px;'),
						'filter' => false
					),
					array(
						'name' => 'status',
						'value' => 'Credits::getStatusName($data->status)',
						'type'=>'raw',
						'filter'=>Credits::getStatusesList(),
					)
				),
			)); ?>
		</div>
    </div>
</fieldset>